// 通用类型定义

// 用户相关
export interface User {
  id: number
  username: string
  name: string
  email: string
  role: string
  avatar?: string
  status: 'active' | 'inactive'
  createdAt: string
  updatedAt: string
}

// 商品相关
export interface Product {
  id: number
  name: string
  code: string
  category: string
  price: number
  costPrice: number
  stock: number
  unit: string
  description?: string
  image?: string
  status: 'active' | 'inactive'
  createdAt: string
  updatedAt: string
}

// 供应商相关
export interface Supplier {
  id: number
  name: string
  code: string
  contact: string
  phone: string
  email?: string
  address: string
  status: 'active' | 'inactive'
  createdAt: string
  updatedAt: string
}

// 门店相关
export interface Store {
  id: number
  name: string
  code: string
  address: string
  phone: string
  manager: string
  area: string
  status: 'active' | 'inactive'
  createdAt: string
  updatedAt: string
}

// 采购订单相关
export interface PurchaseOrder {
  id: number
  orderNo: string
  supplierId: number
  supplier: string
  orderDate: string
  expectedDate: string
  totalAmount: number
  status: 'draft' | 'pending' | 'approved' | 'received' | 'cancelled'
  items: PurchaseOrderItem[]
  createdAt: string
  updatedAt: string
}

export interface PurchaseOrderItem {
  id: number
  productId: number
  productName: string
  productCode: string
  quantity: number
  price: number
  amount: number
}

// 销售订单相关
export interface SalesOrder {
  id: number
  orderNo: string
  customerId?: number
  customerName?: string
  orderDate: string
  totalAmount: number
  status: 'pending' | 'processing' | 'completed' | 'cancelled'
  items: SalesOrderItem[]
  createdAt: string
  updatedAt: string
}

export interface SalesOrderItem {
  id: number
  productId: number
  productName: string
  productCode: string
  quantity: number
  price: number
  amount: number
}

// 库存相关
export interface Inventory {
  id: number
  productId: number
  productName: string
  productCode: string
  storeId: number
  storeName: string
  quantity: number
  reservedQuantity: number
  availableQuantity: number
  minStock: number
  maxStock: number
  lastUpdated: string
}

// 促销活动相关
export interface Promotion {
  id: number
  name: string
  type: 'discount' | 'fullReduction' | 'gift' | 'bundle'
  startTime: string
  endTime: string
  conditions: any
  rewards: any
  status: 'draft' | 'active' | 'expired' | 'disabled'
  createdAt: string
  updatedAt: string
}

// API响应格式
export interface ApiResponse<T = any> {
  code: number
  message: string
  data: T
  success: boolean
}

// 分页参数
export interface PageParams {
  current: number
  pageSize: number
  total?: number
}

// 分页响应
export interface PageResponse<T = any> {
  list: T[]
  total: number
  current: number
  pageSize: number
}